package com.aw.baselib.base

import android.app.Dialog
import android.content.Context
import android.view.LayoutInflater
import android.view.View

/**
 * Created by hzw
 */
abstract class AwBaseDialog(@JvmField protected var mContext: Context) {
    @JvmField
    protected var mDialog: Dialog? = null
    abstract val layoutId: Int

    init {
        val view = LayoutInflater.from(mContext).inflate(layoutId, null)
        initLayoutParams(mContext, view)
    }

    abstract fun initLayoutParams(context: Context?, view: View?)
    open fun show() {
        mDialog!!.show()
    }

    fun dismiss() {
        if (mDialog!!.isShowing) {
            mDialog!!.dismiss()
        }
    }

    val isShowing: Boolean
        get() = mDialog!!.isShowing
}